package com.example.wastes.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.wastes.common.pojo.Order;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    List<Order> findAllName();
    List<Order> findOrderAddress(String address);
    List<Order> findAll();

    @Insert("INSERT INTO tb_order (onumber,uid, address, otime, ntime, state, total) VALUES (#{onumber},#{uid}, #{address}, #{otime}, #{ntime},  #{state}, #{total})")
    int insertOrder(Order order);

    @Update("UPDATE tb_order SET  address=#{address},uid=#{uid}, otime=#{otime}, ntime=#{ntime},  state=#{state}, total=#{total} WHERE onumber=#{onumber}")
    int updateOrder(Order order);

    @Delete("DELETE FROM tb_order WHERE onumber=#{onumber}")
    int deleteOrder(String onumber);
}
/*
package com.example.wastes.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.wastes.common.pojo.Order;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    List<Order> findAllName();
    List<Order> findOrderAddress(String address);
    List<Order> findAll();

    @Insert("INSERT INTO tb_order (onumber, username, address, otime, ntime, staff, state, total) " +
            "VALUES (#{onumber}, #{username}, #{address}, #{otime}, #{ntime}, #{staff}, #{state}, #{total})")
    int insertOrder(Order order);

    @Update("UPDATE tb_order SET username=#{username}, address=#{address}, otime=#{otime}, ntime=#{ntime}, staff=#{staff}, state=#{state}, total=#{total} " +
            "WHERE onumber=#{onumber}")
    int updateOrder(Order order);

    @Delete("DELETE FROM tb_order WHERE onumber=#{onumber}")
    int deleteOrder(String onumber);
}
*/
/*package com.example.wastes.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.wastes.common.pojo.Order;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    List<Order> findAllName();
    List<Order> findOrderAddress(String address);
    List<Order> findAll();

    @Insert("INSERT INTO tb_order (onumber, username, address, otime, ntime, staff, state, total) " +
            "VALUES (#{onumber}, #{username}, #{address}, #{otime}, #{ntime}, #{staff}, #{state}, #{total})")
    int insertOrder(Order order);

    @Update("UPDATE tb_order SET username=#{username}, address=#{address}, otime=#{otime}, ntime=#{ntime}, staff=#{staff}, state=#{state}, total=#{total} " +
            "WHERE onumber=#{onumber}")
    int updateOrder(Order order);

    @Delete("DELETE FROM tb_order WHERE onumber=#{onumber}")
    int deleteOrder(String onumber);
}*/
